package com.hzmg.filter;

import akka.actor.typed.ActorRef;
import akka.actor.typed.javadsl.ActorContext;
import com.hzmg.handler.http.AkkaHttpRoutingHandler;
import com.hzmg.route.RouteDefinition;
import com.hzmg.route.Shift;
import com.hzmg.support.util.NameUtils;

public class RequestAndResponseFilter{

    public static void messageHandle(ActorContext<Shift> context, RouteDefinition routeDefinition) {
        ActorRef<Shift> startSendRef = context.spawn(AkkaHttpRoutingHandler.create(),
                NameUtils.normalizeActorRefSimpleName(AkkaHttpRoutingHandler.class));
        startSendRef.tell(routeDefinition);
    }
}
